<template>
	<view>
		<!-- 顶部导航栏 -->
		<view class="header">
			<x-status-bar></x-status-bar>
			<view class="flex-center-between header-navbar">
				<x-back-btn></x-back-btn>
				<view class="u-f-40 common-title">{{ lang_setting.newNotice }}</view>
				<view></view>
			</view>
			<!-- 分割线 -->
			<u-gap height="1" bgColor="rgba(0, 0, 0, 0.07)"></u-gap>
		</view>
		
		<!-- 内容 -->
		<view>
			<view
			style="padding: 30rpx;">
				<view
				v-for="(item, index) in list"
				:key="index"
				class="flex-center-between u-m-b-28"
				>
					<view>{{ lang_setting[item.key] }}</view>
					<view>
						<u-switch
						v-model="config[item.key]"
						size="48"
						active-color="#FF3A2F"
						></u-switch>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			// 初始化导航
			let navs = [
					{ key: 'openNewNotice', label: '接受新消息提醒' },
					{ key: 'voice', label: '声音' },
					{ key: 'shock', label: '震动' },
				].map(item => {
					let result = {
						...item
					}
					return result
				})
			return {
				navs,
				
				config: {
					openNewNotice: false,
					voice: false,
					shock: false
				},
				loading: false,
				timer: null
			}
		},
		computed: {
			list() {
				return this.config.openNewNotice ? this.navs : [this.navs[0]]
			}
		},
		created() {

		},
		onUnload() {
			this.updateConfig()
		},
		onHide() {
			this.updateConfig()
		},
		methods: {
			// 更新配置项
			updateConfig() {
				
			}
		}
	}
</script>

<style scoped lang="scss">

</style>
